<?php
header("Pragma: no-cache");
header("Cache: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

try {
	require_once "lib/autoload.php";
	session_start();
	session_regenerate_id(true);
	if (!isset($_GET["action"])) {
		throw new Exception("Action não definido!");
	}
	$dest = explode(".", $_GET["action"]);
	$dest[0] .= "bsn";
	$obj = new $dest[0];
	$obj->$dest[1]($_REQUEST);
	echo $obj->toJSON();
} catch (Exception $e) {
	$res['Result'] = "ERROR";
	$res['Message'] = $e->getMessage();
	echo json_encode($res);
}
?> 
